/**
 * 格式说明：属性名称==对应属性编辑器的组件名称
 */

import SlideButtonLeftEditor from "@/components/property-editor/slideButtonLeft-editor.vue"

/**
 * 外观属性
 */
export const APPEARANCE_PROPERTIES = {
  // 字段
  name: 'name-editor',
  staticText: 'staticText-editor',
  strLabel: 'strLabel-editor',
  label: 'label-editor',
  isInput: 'isInput-editor',
  title: 'title-editor',
  isTitle: 'isTitle-editor',
  titleText: 'titleText-editor',
  titleAlign: 'titleAlign-editor',
  bgType: 'bgType-editor',
  img: 'image-editor',
  pngAlign: 'pngAlign-editor',
  color: 'color-editor',
  colorLine: 'colorLine-editor',
  widthLine: 'widthLine-editor',
  opa: 'opa-editor',
  radius: 'radius-editor',
  isCover: 'isCover-editor',
  colorOn: 'colorOn-editor',
  colorOff: 'colorOff-editor',
  highFirst: 'highFirst-editor',
  language: 'language-editor',
  dotNum: 'dotNum-editor',
  isNagetive: 'isNagetive-editor',
  min: 'min-editor',
  max: 'max-editor',
  placeholder: 'placeholder-editor',
  value: 'value-editor',
  optionItems: 'optionItems-editor',
  downWidth: 'downWidth-editor',
  downHeight: 'downHeight-editor',
  downColor: 'downColor-editor',
  downLine: 'downLine-editor',
  downLineColor: 'downLineColor-editor',
  colorSelectLeft: 'colorSelectLeft-editor',
  colorSelectRight: 'colorSelectRight-editor',
  colorSelectLeftFont: 'colorSelectLeftFont-editor',
  colorSelectRightFont: 'colorSelectRightFont-editor',
  selectLeftText: 'selectLeftText-editor',
  selectRightText: 'selectRightText-editor',
  colorSwitch: 'colorSwitch-editor',
  pos: 'pos-editor',
  minrange: 'minrange-editor',
  maxrange: 'maxrange-editor',
  colorSelect: 'colorSelect-editor',
  colorBack: 'colorBack-editor',
  colorQr: 'colorQr-editor',
  pngId: 'pngId-editor',
  pngStartId: 'pngStartId-editor',
  pngSize: 'pngSize-editor',
  timer: 'timer-editor',
  staticTextAlign: 'staticTextAlign-editor',
  isNeedHideDot: 'isNeedHideDot-editor',
  soundId: 'soundId-editor',
  videoId: 'videoId-editor',
  defaultCnt: 'defaultCnt-editor',
  enablePage: 'enablePage-editor',
  voice: 'voice-editor',
  scrollType: 'scrollType-editor',
  scrollHeight: 'scrollHeight-editor',
  scrollWidth: 'scrollWidth-editor',
  rows: 'rows-editor',
  cols: 'cols-editor',
  slideButtonLeft: 'slideButtonLeft-editor',
  gifId: 'gifId-editor',
  slideButtonRight: 'slideButtonRight-editor'
}

/**
 * 位置大小属性
 */
export const POSITION_SIZE_PROPERTIES = {
  x: 'x-editor',
  y: 'y-editor',
  width: 'width-editor',
  height: 'height-editor',
  slideButtonHeight: 'slideButtonHeight-editor',
  slideButtonWidth: 'slideButtonWidth-editor'
}

/**
 * 字体属性
 */
export const FONT_PROPERTIES = {
  fontColor: 'fontColor-editor',
  fontSize: 'fontSize-editor',
  fontType: 'fontType-editor',
  downFontSize: 'downFontSize-editor',
  downFontColor: 'downFontColor-editor'
}

/**
 * 数据属性
 */
export const DATA_PROPERTIES = {
  type: 'type-editor',
  userDataId: 'userDataId-editor',
  userDataAddress: 'userDataAddress-editor',
  userAddressLen: 'userAddressLen-editor',
  modbusAddress: 'modbusAddress-editor',
  modbusAddressLen: 'modbusAddressLen-editor',
  bit: 'bit-editor'
}

/**
 * 杂项属性
 */
export const MISC_PROPERTIES = {
  // 自用属性
  hidden: 'hidden-editor'
}

/**
 * 事件属性
 */
export const EVENT_PROPERTIES = {
  eventCode: 'eventCode-editor',
  event1Code: 'event1Code-editor',
  event2Code: 'event2Code-editor',
  userId: 'userId-editor'
}

/**
 * 判断属性是否已注册
 * @param uniquePropName 属性名称（保证名称唯一，不跟其他组件属性冲突）
 */
export function propertyRegistered(uniquePropName) {
  return (
    !!APPEARANCE_PROPERTIES[uniquePropName] ||
    !!POSITION_SIZE_PROPERTIES ||
    !!FONT_PROPERTIES ||
    !!DATA_PROPERTIES ||
    !!MISC_PROPERTIES ||
    !!EVENT_PROPERTIES[uniquePropName]
  )
}

export default {
  APPEARANCE_PROPERTIES,
  POSITION_SIZE_PROPERTIES,
  FONT_PROPERTIES,
  DATA_PROPERTIES,
  MISC_PROPERTIES,
  EVENT_PROPERTIES,
  propertyRegistered
}
